//------------------------------------------------------------------------------
// menuState
//------------------------------------------------------------------------------
titleActor = gamvas.Actor.extend({
	create: function(name, x, y, file) {
		this._super(name, x, y);
		
		var st = gamvas.state.getCurrentState();
		this.setFile(st.resource.getImage('title.gif'));
		this.setCenter(247/2, 138);
		
		//this.addState(new titleActorState('main'));
		//this.setState('main');
	}
});

buttonActor = gamvas.Actor.extend({
	create: function(name, x, y, file) {
		this._super(name, x, y);
		
		var st = gamvas.state.getCurrentState();
		this.setFile(st.resource.getImage('button_start.gif'));
		this.setCenter(125/2, 90);
		
		st.onMouseUp = function(button, x, y, ev) {
			gamvas.state.setState('game_state');
		};
	}
});

menuState = gamvas.State.extend({
	init: function() {
		this.clearColor = "#083184";
		this.addActor(new titleActor('title_actor', 0, 0));
		this.addActor(new buttonActor('button_actor', 0, 125));
	}
});

//------------------------------------------------------------------------------
// gameState
//------------------------------------------------------------------------------
gameState = gamvas.State.extend({
        draw: function(t) {
            this.c.fillStyle = '#fff';
            this.c.font = 'bold 20px sans-serif';
            this.c.textAlign = 'center';
            this.c.fillText("Hello World!", 0, 0);
        }
});

gamvas.event.addOnLoad(function() {
    gamvas.state.addState(new menuState('menu_state'));
    gamvas.state.addState(new gameState('game_state'));
    gamvas.start('gameCanvas');
});
